﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/JAFagus.Master"  AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Indeco.G24.Website.News.Admin.Default" Title="Tin Tuc Danh Muc" %>
<%@ Register Src="~/UserControls/MenuNewsAdmin.ascx" TagName="Menu" TagPrefix="G24" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server"> 
<script type="text/javascript">
function AddNew1(key,index)
{    
    grid1.AddNewRow();
}
function Edit1(key,index)
{    
    grid1.StartEditRow(index);
}
function Delete1(id, visibleIndex)
    {
        if(confirm('Bạn muốn xóa bản ghi này ?'))         
           {
             grid1.DeleteRow(visibleIndex);                     
           }
    }
function AddNew(key,index)
{    
    grid.AddNewRow();
}
function Edit(key,index)
{    
    grid.StartEditRow(index);
}
    function Delete(id, visibleIndex)
    {
        if(confirm('Bạn muốn xóa bản ghi này ?'))         
           {
             grid.DeleteRow(visibleIndex);                     
           }
    }
</script>
<div style="width:919px;padding:2,2,2,2;">
<div style="float:left;width:190px;margin-left:7px;" >  
<G24:Menu ID="menu1" runat="server" />
</div>
<div style="float:left;width:715px;padding-left:2px;">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
        <td class="tdBCTopLeft"></td>
        <td class="tdBCTopCenter"></td>
        <td class="tdBCTopRight"></td>
        </tr>
        <tr>
        <td class="tdBCMiddleLeft"><div class="tdBCMiddleLeft" style="visibility:hidden"></div></td>
        <td class="tdBCMiddleCenter">
	        <div class="divBCMiddleCenterHeader" >
                <div class="divBCMiddleCenterHeaderTitle" >                 
                    <span class="span-blockTitle"><asp:HyperLink ID="HyperLink2" ForeColor="#FFFFFF" CssClass="span-blockTitleTxt" runat="server">Quản lý danh mục</asp:HyperLink></span>
                </div>
            </div>
            <div class="divBCMiddleCenterContent" style="">
              <dxwgv:ASPxGridView ID="ASPxGridView1"   ClientInstanceName="grid" runat="server" 
     DataSourceID="TinTucDanhMucDataSource" KeyFieldName="IDTinTucDanhMuc" AutoGenerateColumns="False" Width="100%" 
     CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass" 
     OnRowInserting="ASPxGridView1_RowInserting"
      OnRowUpdating="ASPxGridView1_RowUpdating" 
      OnRowDeleted="ASPxGridView1_RowDeleted" 
      OnRowInserted="ASPxGridView1_RowInserted"
       OnRowDeleting="ASPxGridView1_RowDeleting"
    >
     <Columns>
            <dxwgv:GridViewDataColumn Name="Delete" VisibleIndex="3">
            <EditFormSettings VisibleIndex="1" CaptionLocation="None" Visible="False" ColumnSpan="2" />
            <DataItemTemplate>
            <a ID="A2" style="color:#3E6B96;text-decoration:none;" onclick="Edit('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">Edit</a>
            <a ID="A1" style="color:#3E6B96;text-decoration:none;" onclick="AddNew('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">New</a>
            <a ID="DeleteButton" style="color:#3E6B96;text-decoration:none;" onclick="Delete('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">Delete</a>            
            </DataItemTemplate>
            </dxwgv:GridViewDataColumn>
             <dxwgv:GridViewDataTextColumn FieldName="IDTinTucDanhMucCha" Visible="False" VisibleIndex="1" Name="Danh Muc Cha">
                <EditFormSettings VisibleIndex="0" Visible="True" CaptionLocation="None"  />
                <EditItemTemplate>  
                 <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                  Danh Mục Cha      
                 </div>
                 <div style="float:left;">
                 <dxe:ASPxComboBox ID="ASPxComboBox1" runat="server" Value='<%# Bind("IDTinTucDanhMucCha")%>' 
                    TextField="Ten" ValueField="IDTinTucDanhMuc" DataSourceID="Custommize" ValueType="System.Guid"  DropDownStyle="DropDown">                     
                    </dxe:ASPxComboBox>
                 </div> 
                    </div>         
                   <data:TinTucDanhMucDataSource ID="Custommize" SelectMethod="GetPaged" runat="server" >
                        <Parameters>        
                         <data:SqlParameter Name="WhereClause" UseParameterizedFilters="false">    
                         <Filters>
                            <data:TinTucDanhMucFilter Column="IDTinTucDanhMucCha"  ControlID="lblCatIDSelected" />
                         </Filters>
                         </data:SqlParameter>
                        </Parameters>
                        </data:TinTucDanhMucDataSource> 
                </EditItemTemplate>                
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="Ten" VisibleIndex="0" Name="Ten">
                <EditFormSettings VisibleIndex="1" Visible="True" CaptionLocation="None" />
                 <EditItemTemplate>
                     <div id="divTen" align="left">
                      <div style="float:left;width:100px;">
                  Tên     
                 </div>
                 <div style="float:left;">
                <dxe:ASPxTextBox ID="Ten"  runat="server" Width="200px" Text='<%# Bind("Ten") %>'>
                    </dxe:ASPxTextBox>
                 </div>                   
                    </div>
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="SoLienKet" Visible="False" VisibleIndex="2" Name="So Lien Ket">
                <EditFormSettings VisibleIndex="2" CaptionLocation="None" Visible="True" />
                <EditItemTemplate>
                <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                 Số Liên Kết     
                 </div>
                 <div style="float:left;">
                 <dxe:ASPxTextBox ID="SoLienKet" style=" text-align:right;" runat="server" Width="80px" Text='<%# Bind("SoLienKet") %>'>
                    </dxe:ASPxTextBox>
                 </div>                
                </div>                    
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="ViTri" Visible="False"  VisibleIndex="3" Name="Vi Tri">
                <EditFormSettings VisibleIndex="3" Visible="True" CaptionLocation="None" />
                <EditItemTemplate>
                 <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                  Vị Trí     
                 </div>
                 <div style="float:left;">
                 <dxe:ASPxTextBox ID="ViTri"  runat="server" Width="80px" Text='<%# Bind("ViTri") %>'>
                    </dxe:ASPxTextBox>
                 </div>                   
                  </div>
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="NhaCungCap" VisibleIndex="1" Name="Nha Cung Cap">
                <EditFormSettings VisibleIndex="4" Caption="Nha Cung Cap" Visible="False" />                
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataCheckColumn FieldName="TrangThai"  Visible="False" VisibleIndex="5" Name="Trang Thai">
                <EditFormSettings VisibleIndex="5" Visible="True" CaptionLocation="None" />
                 <EditItemTemplate>
                <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                  Trạng Thái     
                 </div>
                 <div style="float:left;">                 
                     <dxe:ASPxCheckBox ID="dataTrangThai" runat="server" Width="100px" Value='<%# Bind("TrangThai") %>' ValueType="System.Boolean">
                 </dxe:ASPxCheckBox>
                 </div>               
                 </div>
                 </EditItemTemplate>       
             </dxwgv:GridViewDataCheckColumn>
              <dxwgv:GridViewDataDateColumn FieldName="ThoiDiemChinhSua" Visible="False" VisibleIndex="6" Name="Thoi Diem Chinh Sua">
                <EditFormSettings VisibleIndex="6" Caption="Thoi Diem Chinh Sua"  Visible="False"/>              
             </dxwgv:GridViewDataDateColumn>
              <dxwgv:GridViewDataDateColumn FieldName="ThoiDiemCapNhat" VisibleIndex="2" Name="Thoi Diem Cap Nhat">
                <EditFormSettings VisibleIndex="7" Caption="Thoi Diem Cap Nhat" Visible="False" />                 
             </dxwgv:GridViewDataDateColumn>           
     </Columns>
     <Templates>
     <DetailRow>
     <dxwgv:ASPxGridView ID="ASPxGridView2"   ClientInstanceName="grid1" runat="server" 
     DataSourceID="TinTucDanhMucDataSource1" KeyFieldName="IDTinTucDanhMuc" AutoGenerateColumns="False" Width="100%" 
     CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass" 
     OnRowInserting="ASPxGridView2_RowInserting"
      OnRowUpdating="ASPxGridView2_RowUpdating" 
      OnRowDeleted="ASPxGridView2_RowDeleted" 
      OnRowInserted="ASPxGridView2_RowInserted"
       OnRowDeleting="ASPxGridView2_RowDeleting"
       OnBeforePerformDataSelect="ASPxGridView2_DataSelect"
    >
     <Columns>
            <dxwgv:GridViewDataColumn Name="Delete" VisibleIndex="3">
            <EditFormSettings VisibleIndex="1" CaptionLocation="None" Visible="False" ColumnSpan="2" />
            <DataItemTemplate>
            <a ID="A2" style="color:#3E6B96;text-decoration:none;" onclick="Edit1('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">Edit</a>
            <a ID="A1" style="color:#3E6B96;text-decoration:none;" onclick="AddNew1('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">New</a>
            <a ID="DeleteButton" style="color:#3E6B96;text-decoration:none;" onclick="Delete1('<%# Container.KeyValue.ToString()%>', '<%# Container.VisibleIndex.ToString()%>')" href="#">Delete</a>            
            </DataItemTemplate>
            </dxwgv:GridViewDataColumn>
             <dxwgv:GridViewDataTextColumn FieldName="IDTinTucDanhMucCha" Visible="False" VisibleIndex="1" Name="Danh Muc Cha">
                <EditFormSettings VisibleIndex="0" Visible="True" CaptionLocation="None"  />
                <EditItemTemplate>  
                 <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                  Danh Mục Cha      
                 </div>
                 <div style="float:left;">
                 <dxe:ASPxComboBox ID="ASPxComboBox1" runat="server" Value='<%# Bind("IDTinTucDanhMucCha")%>' 
                    TextField="Ten" ValueField="IDTinTucDanhMuc" DataSourceID="Custommize" ValueType="System.Guid"  DropDownStyle="DropDown">                     
                    </dxe:ASPxComboBox>
                 </div> 
                    </div>         
                   <data:TinTucDanhMucDataSource ID="Custommize" SelectMethod="GetPaged" runat="server" >
                        <Parameters>        
                         <data:SqlParameter Name="WhereClause" UseParameterizedFilters="false">    
                         <Filters>
                            <data:TinTucDanhMucFilter Column="IDTinTucDanhMucCha"  ControlID="lblCatIDSelected" />
                         </Filters>
                         </data:SqlParameter>
                        </Parameters>
                        </data:TinTucDanhMucDataSource> 
                </EditItemTemplate>                
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="Ten" VisibleIndex="0" Name="Ten">
                <EditFormSettings VisibleIndex="1" Visible="True" CaptionLocation="None" />
                 <EditItemTemplate>
                     <div id="divTen" align="left">
                      <div style="float:left;width:100px;">
                  Tên     
                 </div>
                 <div style="float:left;">
                <dxe:ASPxTextBox ID="Ten"  runat="server" Width="200px" Text='<%# Bind("Ten") %>'>
                    </dxe:ASPxTextBox>
                 </div>                   
                    </div>
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="SoLienKet" Visible="False" VisibleIndex="2" Name="So Lien Ket">
                <EditFormSettings VisibleIndex="2" CaptionLocation="None" Visible="True" />
                <EditItemTemplate>
                <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                 Số Liên Kết     
                 </div>
                 <div style="float:left;">
                 <dxe:ASPxTextBox ID="SoLienKet" style=" text-align:right;" runat="server" Width="80px" Text='<%# Bind("SoLienKet") %>'>
                    </dxe:ASPxTextBox>
                 </div>                
                </div>                    
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="ViTri" Visible="False"  VisibleIndex="3" Name="Vi Tri">
                <EditFormSettings VisibleIndex="3" Visible="True" CaptionLocation="None" />
                <EditItemTemplate>
                 <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                  Vị Trí     
                 </div>
                 <div style="float:left;">
                 <dxe:ASPxTextBox ID="ViTri"  runat="server" Width="80px" Text='<%# Bind("ViTri") %>'>
                    </dxe:ASPxTextBox>
                 </div>                   
                  </div>
                </EditItemTemplate>
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataTextColumn FieldName="NhaCungCap" VisibleIndex="1" Name="Nha Cung Cap">
                <EditFormSettings VisibleIndex="4" Caption="Nha Cung Cap" Visible="False" />                
             </dxwgv:GridViewDataTextColumn>
              <dxwgv:GridViewDataCheckColumn FieldName="TrangThai"  Visible="False" VisibleIndex="5" Name="Trang Thai">
                <EditFormSettings VisibleIndex="5" Visible="True" CaptionLocation="None" />
                 <EditItemTemplate>
                <div id="divTen" align="left">
                 <div style="float:left;width:100px;">
                  Trạng Thái     
                 </div>
                 <div style="float:left;">                 
                     <dxe:ASPxCheckBox ID="dataTrangThai" runat="server" Width="100px" Value='<%# Bind("TrangThai") %>' ValueType="System.Boolean">
                 </dxe:ASPxCheckBox>
                 </div>               
                 </div>
                 </EditItemTemplate>       
             </dxwgv:GridViewDataCheckColumn>
              <dxwgv:GridViewDataDateColumn FieldName="ThoiDiemChinhSua" Visible="False" VisibleIndex="6" Name="Thoi Diem Chinh Sua">
                <EditFormSettings VisibleIndex="6" Caption="Thoi Diem Chinh Sua"  Visible="False"/>              
             </dxwgv:GridViewDataDateColumn>
              <dxwgv:GridViewDataDateColumn FieldName="ThoiDiemCapNhat" VisibleIndex="2" Name="Thoi Diem Cap Nhat">
                <EditFormSettings VisibleIndex="7" Caption="Thoi Diem Cap Nhat" Visible="False" />                 
             </dxwgv:GridViewDataDateColumn>           
     </Columns>
    <Styles CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass">
    <AlternatingRow Enabled="True"/>
        <Header ImageSpacing="5px" SortingImageSpacing="5px">
        </Header>
     </Styles>  
         <SettingsCustomizationWindow Enabled="True"  />
         <SettingsEditing PopupEditFormModal="True" Mode="EditForm"  />
        <SettingsText Title="Tin Tuc Danh Muc"  />        
         <Images ImageFolder="~/App_Themes/BlackGlass/{0}/">
         </Images>
         <SettingsPager PageSize="15">
         </SettingsPager>
    </dxwgv:ASPxGridView>
     </DetailRow>
     </Templates>
    <Styles CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass">
    <AlternatingRow Enabled="True"/>
        <Header ImageSpacing="5px" SortingImageSpacing="5px">
        </Header>
     </Styles>         
        <SettingsDetail ShowDetailRow="True"/>
         <SettingsCustomizationWindow Enabled="True"  />
         <SettingsEditing PopupEditFormModal="True" Mode="EditForm"  />
        <SettingsText Title="Tin Tuc Danh Muc"  />        
         <Images ImageFolder="~/App_Themes/BlackGlass/{0}/">
         </Images>
         <SettingsPager PageSize="15">
         </SettingsPager>
    </dxwgv:ASPxGridView>
            <div align="left" style="float:left;width:702px;padding-left:4px;margin-top:2px;">
           <asp:Button ID="Button1" CssClass="button" runat="server" Text="Create SiteMap" /><span style="color:Red">* Important</span>
              </div>
            </div>
        </td>
        <td class="tdBCMiddleRight"><div class="tdBCMiddleRight" style="visibility:hidden"></div></td>
        </tr>
        <tr>
        <td class="tdBCBottomLeft"></td>
        <td class="tdBCBottomCenter"></td>
        <td class="tdBCBottomRight"></td>
        </tr>
    </table>
       
 <data:TinTucDanhMucDataSource ID="TinTucDanhMucDataSource" runat="server"
			SelectMethod="GetPaged"
			UpdateMethod="Update"
			InsertMethod="Insert"
			EnableTransaction="true"			
			EnablePaging="True"
			EnableSorting="True" >	
			<Parameters>        
             <data:SqlParameter Name="WhereClause" UseParameterizedFilters="false">    
             <Filters>
                <data:TinTucDanhMucFilter Column="IDTinTucDanhMucCha"  ControlID="lblCatIDSelected" />
             </Filters>
             </data:SqlParameter>
            </Parameters>
		</data:TinTucDanhMucDataSource>   
 <data:TinTucDanhMucDataSource ID="Custommized" SelectMethod="GetPaged" runat="server"
	 InsertMethod="Insert"
	 >
            <Parameters>        
             <data:SqlParameter Name="WhereClause" UseParameterizedFilters="false">    
             <Filters>
                <data:TinTucDanhMucFilter Column="IDTinTucDanhMucCha"  SessionField="IDDanhMuc" />
             </Filters>
             </data:SqlParameter>
            </Parameters>
        </data:TinTucDanhMucDataSource>  
        <data:TinTucDanhMucDataSource ID="TinTucDanhMucDataSource1" runat="server"
			SelectMethod="GetPaged"
			UpdateMethod="Update"
			InsertMethod="Insert"
			EnableTransaction="true"			
			EnablePaging="True"
			EnableSorting="True" >	
			<Parameters>        
             <data:SqlParameter Name="WhereClause" UseParameterizedFilters="false">    
             <Filters>
                <data:TinTucDanhMucFilter Column="IDTinTucDanhMucCha"  SessionField="IDTinTucDanhMuc" />
             </Filters>
             </data:SqlParameter>
            </Parameters>
		</data:TinTucDanhMucDataSource>	    
 <asp:Label ID="lblCatIDSelected" runat="server" Text='' Visible="false"></asp:Label><br />
</div>
</div>

 
	 
</asp:Content>
